{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2d14bbbf",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Author: Zhichao\n",
    "# week05: 数据结构之列表\n",
    "\n",
    "# 补充用户信息: 打印 （print）\n",
    "# input -> str  如果想让输入的数据类型变成int 需要强制转变数据类型\n",
    "name = input(\"name: \")\n",
    "age = int(input(\"age: \"))\n",
    "job = input(\"job: \")\n",
    "salary = int(input(\"salary: \"))\n",
    "\n",
    "# info = '''--------- INFO '''+ name +'''----------'''+'''\n",
    "# name: '''+name+'''\n",
    "# age: '''+age+'''\n",
    "# job: '''+job+'''\n",
    "# salary:'''+salary\n",
    "# print(info)\n",
    "\n",
    "# 占位符有顺序！请依次填入内容\n",
    "# 思考： 如果有很多个位置呢？如果是一个HTML页面需要很多数据来占用位置\n",
    "#       对顺序要求太苛刻了，容易出错。\n",
    "info_02 = '''--------INFO %s --------\n",
    "name: %s\n",
    "age: %d\n",
    "job: %s\n",
    "salary: %d\n",
    "'''%(name,name,age,job,salary)\n",
    "print(info_02)\n",
    "\n",
    "# .format() 是一个字符串的格式化方法/函数 优化 占位符\n",
    "# 优势： 1.不需要考虑参数出现的顺序\n",
    "#       2.多个重复项只需要赋值一次（明确数据输入（如：变量age）和输出（如：打印的HTML_age））\n",
    "# info_03 = '''-------INFO {HTML_name} -------\n",
    "# name: {HTML_name}\n",
    "# age: {HTML_age}\n",
    "# job: {HTML_job}\n",
    "# salary: {HTML_salary}\n",
    "# '''.format(HTML_age=age,HTML_salary=salary,HTML_job=job,HTML_name=name)\n",
    "#\n",
    "# print(info_03)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
